Integrand size = 40, antiderivative size = 187 \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\frac {\left (2 a^2+b^2\right ) (b B-a C) \text {arctanh}(\sin (c+d x))}{2 b^4 d}-\frac {2 a^3 (b B-a C) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^4 \sqrt {a+b} d}-\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d} \]
[Out]
Time = 0.82 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.225, Rules used = {4157, 4118, 4177, 4167, 4083, 3855, 3916, 2738, 214} \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=-\frac {2 a^3 (b B-a C) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^4 d \sqrt {a-b} \sqrt {a+b}}+\frac {\left (2 a^2+b^2\right ) (b B-a C) \text {arctanh}(\sin (c+d x))}{2 b^4 d}-\frac {\left (-3 a^2 C+3 a b B-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \tan (c+d x) \sec (c+d x)}{2 b^2 d}+\frac {C \tan (c+d x) \sec ^2(c+d x)}{3 b d} \]
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4083
Rule 4118
Rule 4157
Rule 4167
Rule 4177
Rubi steps \begin{align*} \text {integral}& = \int \frac {\sec ^4(c+d x) (B+C \sec (c+d x))}{a+b \sec (c+d x)} \, dx \\ & = \frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}+\frac {\int \frac {\sec ^2(c+d x) \left (2 a C+2 b C \sec (c+d x)+3 (b B-a C) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{3 b} \\ & = \frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}+\frac {\int \frac {\sec (c+d x) \left (3 a (b B-a C)+b (3 b B+a C) \sec (c+d x)-2 \left (3 a b B-3 a^2 C-2 b^2 C\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{6 b^2} \\ & = -\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}+\frac {\int \frac {\sec (c+d x) \left (3 a b (b B-a C)+3 \left (2 a^2+b^2\right ) (b B-a C) \sec (c+d x)\right )}{a+b \sec (c+d x)} \, dx}{6 b^3} \\ & = -\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}-\frac {\left (a^3 (b B-a C)\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{b^4}+\frac {\left (\left (2 a^2+b^2\right ) (b B-a C)\right ) \int \sec (c+d x) \, dx}{2 b^4} \\ & = \frac {\left (2 a^2+b^2\right ) (b B-a C) \text {arctanh}(\sin (c+d x))}{2 b^4 d}-\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}-\frac {\left (a^3 (b B-a C)\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b^5} \\ & = \frac {\left (2 a^2+b^2\right ) (b B-a C) \text {arctanh}(\sin (c+d x))}{2 b^4 d}-\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d}-\frac {\left (2 a^3 (b B-a C)\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^5 d} \\ & = \frac {\left (2 a^2+b^2\right ) (b B-a C) \text {arctanh}(\sin (c+d x))}{2 b^4 d}-\frac {2 a^3 (b B-a C) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^4 \sqrt {a+b} d}-\frac {\left (3 a b B-3 a^2 C-2 b^2 C\right ) \tan (c+d x)}{3 b^3 d}+\frac {(b B-a C) \sec (c+d x) \tan (c+d x)}{2 b^2 d}+\frac {C \sec ^2(c+d x) \tan (c+d x)}{3 b d} \\ \end{align*}
Leaf count is larger than twice the leaf count of optimal. \(422\) vs. \(2(187)=374\).
Time = 2.25 (sec) , antiderivative size = 422, normalized size of antiderivative = 2.26 \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\frac {\frac {24 a^3 (b B-a C) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+6 \left (2 a^2+b^2\right ) (-b B+a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-6 \left (2 a^2+b^2\right ) (-b B+a C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^2 (-3 a C+b (3 B+C))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 b^3 C \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {4 b \left (-3 a b B+3 a^2 C+2 b^2 C\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 b^3 C \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}-\frac {b^2 (-3 a C+b (3 B+C))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b \left (-3 a b B+3 a^2 C+2 b^2 C\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}}{12 b^4 d} \]
[In]
[Out]
Time = 0.54 (sec) , antiderivative size = 335, normalized size of antiderivative = 1.79
method | result | size |
derivativedivides | \(\frac {-\frac {C}{3 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {B b -C a -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {\left (2 B \,a^{2} b +B \,b^{3}-2 a^{3} C -C a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 b^{4}}-\frac {-2 B a b -B \,b^{2}+2 C \,a^{2}+C a b +2 C \,b^{2}}{2 b^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {2 a^{3} \left (B b -C a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{4} \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {C}{3 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {-B b +C a +C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\frac {\left (-2 B \,a^{2} b -B \,b^{3}+2 a^{3} C +C a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 b^{4}}-\frac {-2 B a b -B \,b^{2}+2 C \,a^{2}+C a b +2 C \,b^{2}}{2 b^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}}{d}\) | \(335\) |
default | \(\frac {-\frac {C}{3 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {B b -C a -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {\left (2 B \,a^{2} b +B \,b^{3}-2 a^{3} C -C a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 b^{4}}-\frac {-2 B a b -B \,b^{2}+2 C \,a^{2}+C a b +2 C \,b^{2}}{2 b^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}-\frac {2 a^{3} \left (B b -C a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{4} \sqrt {\left (a +b \right ) \left (a -b \right )}}-\frac {C}{3 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {-B b +C a +C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\frac {\left (-2 B \,a^{2} b -B \,b^{3}+2 a^{3} C +C a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 b^{4}}-\frac {-2 B a b -B \,b^{2}+2 C \,a^{2}+C a b +2 C \,b^{2}}{2 b^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}}{d}\) | \(335\) |
risch | \(\frac {i \left (-3 B \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+3 C a b \,{\mathrm e}^{5 i \left (d x +c \right )}-6 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+6 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-12 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+12 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+12 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+3 B \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-3 C b a \,{\mathrm e}^{i \left (d x +c \right )}-6 B a b +6 C \,a^{2}+4 C \,b^{2}\right )}{3 d \,b^{3} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,a^{2}}{b^{3} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 b d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{3} C}{b^{4} d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{2 b^{2} d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, d \,b^{3}}-\frac {a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,b^{4}}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, d \,b^{3}}+\frac {a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,b^{4}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,a^{2}}{b^{3} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 b d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{3} C}{b^{4} d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{2 b^{2} d}\) | \(659\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 343 vs. \(2 (170) = 340\).
Time = 0.70 (sec) , antiderivative size = 743, normalized size of antiderivative = 3.97 \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\left [-\frac {6 \, {\left (C a^{4} - B a^{3} b\right )} \sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )^{3} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 3 \, {\left (2 \, C a^{5} - 2 \, B a^{4} b - C a^{3} b^{2} + B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, C a^{5} - 2 \, B a^{4} b - C a^{3} b^{2} + B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, C a^{2} b^{3} - 2 \, C b^{5} + 2 \, {\left (3 \, C a^{4} b - 3 \, B a^{3} b^{2} - C a^{2} b^{3} + 3 \, B a b^{4} - 2 \, C b^{5}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (C a^{3} b^{2} - B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, {\left (a^{2} b^{4} - b^{6}\right )} d \cos \left (d x + c\right )^{3}}, \frac {12 \, {\left (C a^{4} - B a^{3} b\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \cos \left (d x + c\right )^{3} - 3 \, {\left (2 \, C a^{5} - 2 \, B a^{4} b - C a^{3} b^{2} + B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, {\left (2 \, C a^{5} - 2 \, B a^{4} b - C a^{3} b^{2} + B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (2 \, C a^{2} b^{3} - 2 \, C b^{5} + 2 \, {\left (3 \, C a^{4} b - 3 \, B a^{3} b^{2} - C a^{2} b^{3} + 3 \, B a b^{4} - 2 \, C b^{5}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (C a^{3} b^{2} - B a^{2} b^{3} - C a b^{4} + B b^{5}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, {\left (a^{2} b^{4} - b^{6}\right )} d \cos \left (d x + c\right )^{3}}\right ] \]
[In]
[Out]
\[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\int \frac {\left (B + C \sec {\left (c + d x \right )}\right ) \sec ^{4}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 412 vs. \(2 (170) = 340\).
Time = 0.36 (sec) , antiderivative size = 412, normalized size of antiderivative = 2.20 \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=-\frac {\frac {3 \, {\left (2 \, C a^{3} - 2 \, B a^{2} b + C a b^{2} - B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{4}} - \frac {3 \, {\left (2 \, C a^{3} - 2 \, B a^{2} b + C a b^{2} - B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{4}} - \frac {12 \, {\left (C a^{4} - B a^{3} b\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} b^{4}} + \frac {2 \, {\left (6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 6 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 12 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 12 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, C a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 6 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, C a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3} b^{3}}}{6 \, d} \]
[In]
[Out]
Time = 22.10 (sec) , antiderivative size = 4667, normalized size of antiderivative = 24.96 \[ \int \frac {\sec ^3(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx=\text {Too large to display} \]
[In]
[Out]